<?php
    include '../Include/header.inc.php';
    include '../Include/functGestionParams.inc.php';
    
    
    if(isset($_POST['RAFRAICHISSEMENT'])){
        
        $RAFRAICHISSEMENT=$_POST['RAFRAICHISSEMENT'];
        $ANNEEEDITION=$_POST['ANNEEEDITION'];

        $DATEDEBUT=implode("-", array($_POST['element_2_2'], $_POST['element_2_2'], $_POST['element_2_1']));
        $DATEFIN=implode("-", array($_POST['element_3_2'], $_POST['element_3_2'], $_POST['element_3_1']));
        

        
        
        updateParams($RAFRAICHISSEMENT,$ANNEEEDITION,$DATEDEBUT,$DATEFIN);
      
        
    }
    
    
    
    
    $params=SelectParams();
    
 //   print_r($params);
    
    $datedebut= explode("-", $params['DATEDEBUT']);
                $datefin= explode("-", $params['DATEFIN']);

?>
	<img id="top" src="top.png" alt="">
	<div id="form_container">
	<?php if(isset($_POST['RAFRAICHISSEMENT'])) echo "<center>Modifications enregistrées</center>";?>
		<h1><a>Modification Paramètres</a></h1>
		<form id="form_328829" class="appnitro"  method="post" action="homeParametres.php">
					<div class="form_description">
			<h2>Modification Paramètres</h2>
			<p>Modification Paramètres</p>
		</div>						
			<ul >
			
					<li id="li_1" >
		<label class="description" for="element_1">Temps Rafraîchissement évènements </label>
		<div>
			<input id="element_1" required = "required" type="number"  min="0" name="RAFRAICHISSEMENT" class="element text medium" type="text" maxlength="255" value="<?php echo $params['RAFRAICHISSEMENT'] ?>"/> 
		</div> 
		</li>		<li id="li_4" >
		<label class="description" for="element_4">Année d'édition </label>
		<div>
			<input id="element_4" required = "required" type="number" min="2000" name="ANNEEEDITION" class="element text medium" type="text" maxlength="255" value="<?php echo $params['ANNEEEDITION'] ?>"/> 
		</div> 
		</li>		<li id="li_2" >
		<label class="description" for="element_2">Date début </label>
		<span>
			<input id="element_2_1" required = "required" name="element_2_1" class="element text" size="2" maxlength="2" value="<?php echo $datedebut[2]?>" type="text"> /
			<label for="element_2_1">DD</label>
		</span>
		<span>
			<input id="element_2_2" required = "required" name="element_2_2" class="element text" size="2" maxlength="2" value="<?php echo $datedebut[1]?>" type="text"> /
			<label for="element_2_2">MM</label>
		</span>
		<span>
	 		<input id="element_2_3" required = "required" name="element_2_3" class="element text" size="4" maxlength="4" value="<?php echo $datedebut[0]?>" type="text">
			<label for="element_2_3">YYYY</label>
		</span>
	
		<span id="calendar_2">
			<img id="cal_img_2" class="datepicker" src="images/calendar.gif" alt="Pick a date.">	
		</span>
		<script type="text/javascript">
			Calendar.setup({
			inputField	 : "element_2_3",
			baseField    : "element_2",
			displayArea  : "calendar_2",
			button		 : "cal_img_2",
			ifFormat	 : "%B %e, %Y",
			onSelect	 : selectEuropeDate
			});
		</script>
		 
		</li>		<li id="li_3" >
		<label class="description" for="element_3">Date fin </label>
		<span>
			<input id="element_3_1" required = "required" name="element_3_1" class="element text" size="2" maxlength="2" value="<?php echo $datefin[2]?>" type="text"> /
			<label for="element_3_1">DD</label>
		</span>
		<span>
			<input id="element_3_2" required = "required" name="element_3_2" class="element text" size="2" maxlength="2" value="<?php echo $datefin[1]?>" type="text"> /
			<label for="element_3_2">MM</label>
		</span>
		<span>
	 		<input id="element_3_3" required = "required" name="element_3_3" class="element text" size="4" maxlength="4" value="<?php echo $datefin[0]?>" type="text">
			<label for="element_3_3">YYYY</label>
		</span>
	
		<span id="calendar_3">
			<img id="cal_img_3" class="datepicker" src="images/calendar.gif" alt="Pick a date.">	
		</span>
		<script type="text/javascript">
			Calendar.setup({
			inputField	 : "element_3_3",
			baseField    : "element_3",
			displayArea  : "calendar_3",
			button		 : "cal_img_3",
			ifFormat	 : "%B %e, %Y",
			onSelect	 : selectEuropeDate
			});
		</script>
		 
		</li>
			
					<li class="buttons">
			    
			    
				<input id="saveForm" class="button_text" type="submit" name="Update" value="Submit" />
		</li>
			</ul>
		</form>
<?php
    include("../include/footer.php");
?>